package com.onlineMIS.ORM.entity.headQ.barcodeGentor;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;

import com.onlineMIS.common.ExcelTemplate;

public class TagPrintTemplate extends ExcelTemplate{
	
	private List<TagPrintVO> tagPrintVOs = new ArrayList<TagPrintVO>();

	public TagPrintTemplate(){
		super();
	}
	
	/**
	 * @param templateWorkbookPath
	 * @throws IOException
	 */
	public TagPrintTemplate(List<TagPrintVO> vos, String templateWorkbookPath) throws IOException{
		super(templateWorkbookPath);
		this.tagPrintVOs = vos;
	}


	public HSSFWorkbook process(){
		HSSFSheet sheet = templateWorkbook.getSheetAt(0);

		if (tagPrintVOs != null)
			for (int i = 0; i < tagPrintVOs.size(); i++){
				
				Row row = sheet.createRow(i+1);
				TagPrintVO tagPrintVO = tagPrintVOs.get(i);
				
				row.createCell(0).setCellValue(tagPrintVO.getBarcode());
				row.createCell(1).setCellValue(tagPrintVO.getBrand());
				row.createCell(2).setCellValue(tagPrintVO.getProductCode());
				row.createCell(3).setCellValue(tagPrintVO.getColor());
				row.createCell(4).setCellValue(tagPrintVO.getCategory());
				row.createCell(5).setCellValue(tagPrintVO.getSalesPrice());
				row.createCell(6).setCellValue(tagPrintVO.getQuantity());
				row.createCell(7).setCellValue(tagPrintVO.getDan());
				row.createCell(8).setCellValue(tagPrintVO.getSize());
				row.createCell(9).setCellValue("");
				row.createCell(10).setCellValue("");
				row.createCell(11).setCellValue("");
				row.createCell(12).setCellValue("");
				row.createCell(13).setCellValue("");
				row.createCell(14).setCellValue("");
				row.createCell(15).setCellValue("");
				row.createCell(16).setCellValue("");
				row.createCell(17).setCellValue(tagPrintVO.getCategoryLevel());
				row.createCell(18).setCellValue(tagPrintVO.getProductIdentity());
				row.createCell(19).setCellValue(tagPrintVO.getFactoryCode());
			}

		return templateWorkbook;
	}

}

